/* eslint-disable new-cap */
import L from "leaflet";
import "./leaflet-tilelayer-wmts.js";

const token = [
  "06473388dcaaec1491b0894982620ffb",
  "5cc075823d89f6bea6cddef71663b233",
  "c7e27425bd44e20bfa9270930aa197b4",
  "fc9331f3263bb36294feb1643f804e90",
  '34d27e0c080e2708930a7d567de67ea4'
];
let tk = token[parseInt(Math.random() * token.length)]; // 随机token

export const BaseLayer = {
  OneStreetLayer: new L.layerGroup([
    // new L.TileLayer.WMTS(one，two) oneWMTS服务的URL模版，two设施WMTS图层的行为和外观
    new L.TileLayer.WMTS(
      "http://223.4.72.162:16080/arcgis/rest/services/basemap/WYX1029/MapServer/WMTS/tile/1.0.0/basemap_WYX1029/default/default028mm/",
      {
        layer: "onemap", // WMTS服务中的图层名称
        minZoom: 0, // 最小缩放级别
        maxZoom: 18, // 最大缩放级别
        tileSize: 256, // 单个瓦片的宽度和高度（以像素为单位）
        styles: "default", // WMTS服务中的样式名称
        tilematrixSet: "default028mm", // WMTS服务中的瓦片矩阵集名称
        format: "tile", // 请求瓦片图像格式，默认inage/png，也可以是image/jpeg
        subdomains: ["0", "1", "2", "3", "4", "5", "6"],
      }
    ),
  ]),
  OneImageLayer: new L.layerGroup([
    new L.TileLayer.WMTS(
      "http://223.4.72.162:16080/arcgis/rest/services/basemap/ZJRasterMap/MapServer/WMTS/tile/1.0.0/basemap_ZJRasterMap/default/default028mm/",
      {
        minZoom: 0,
        maxZoom: 18,
        tileSize: 256,
        layer: "onemap",
        styles: "default",
        tilematrixSet: "c",
        format: "tile",
        subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
      }
    ),
    new L.TileLayer.WMTS(
      "http://223.4.72.162:16080/arcgis/rest/services/basemap/YingXiangZhuJi/MapServer/WMTS/tile/1.0.0/basemap_YingXiangZhuJi/default/default028mm/",
      {
        minZoom: 0,
        maxZoom: 18,
        tileSize: 256,
        layer: "onemap",
        styles: "default",
        tilematrixSet: "c",
        format: "tile",
        subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
      }
    ),
  ]),
  OneTopoMap: new L.layerGroup([
    new L.TileLayer.WMTS(
      "https://sldtpt.zjwater.com:8443/waterplatzj1/proxy.jsp?http://223.4.72.162:18099/PBS/rest/services/DXVectorMap2021/MapServer/tile",
      {
        minZoom: 0,
        maxZoom: 16,
        tileSize: 256,
        layer: "onemap",
        styles: "default",
        tilematrixSet: "c",
        format: "tile",
        subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
      }
    ),
  ]),
  PrintLayer: new L.layerGroup([
    new L.TileLayer.WMTS(
      "http://223.4.72.162:16080/arcgis/rest/services/zjslmap/zjslRasternew/MapServer/WMTS/tile/1.0.0/zjslmap_zjslRasternew/default/default028mm/",
      {
        minZoom: 0,
        maxZoom: 18,
        tileSize: 256,
        layer: "onemap",
        styles: "default",
        tilematrixSet: "c",
        format: "tile",
        subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
      }
    ),
    new L.TileLayer.WMTS(
      "http://223.4.72.162:16080/arcgis/rest/services/zjslmap/ZJSLRasterAnno0717/MapServer/WMTS/tile/1.0.0/zjslmap_ZJSLRasterAnno0717/default/default028mm/",
      {
        minZoom: 0,
        maxZoom: 18,
        tileSize: 256,
        layer: "onemap",
        styles: "default",
        tilematrixSet: "c",
        format: "tile",
        subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
      }
    ),
  ]),
  normalm: new L.layerGroup([
    new L.TileLayer.WMTS("http://t{s}.tianditu.gov.cn/vec_c/wmts", {
      minZoom: 0,
      maxZoom: 18,
      tileSize: 256,
      layer: "vec",
      styles: "default",
      tilematrixSet: "c",
      tk: "2973256a129b9e727e80cc297545ba0a",
      format: "tile",
      subdomains: ["0", "1", "2", "3", "4", "5", "6"],
    }),
    new L.TileLayer.WMTS("http://srv{s}.zjditu.cn/ZJEMAP_2D/wmts", {
      minZoom: 8,
      maxZoom: 18,
      tileSize: 256,
      layer: "TDT_ZJEMAP",
      styles: "default",
      tilematrixSet: "default028mm",
      format: "image/jpgpng",
      subdomains: ["0", "1", "2", "3", "4", "5", "6"],
    }),
  ]),
  normala: new L.layerGroup([
    new L.TileLayer.WMTS("http://t{s}.tianditu.gov.cn/cva_c/wmts", {
      minZoom: 0,
      maxZoom: 18,
      tileSize: 256,
      layer: "cva",
      tk: "2973256a129b9e727e80cc297545ba0a",
      styles: "default",
      tilematrixSet: "c",
      format: "tile",
      subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
    }),
  ]),
  imgm: new L.layerGroup([
    new L.TileLayer.WMTS("http://t{s}.tianditu.gov.cn/img_c/wmts", {
      minZoom: 0,
      maxZoom: 18,
      LAYER: "img",
      tk: tk,
      style: "default",
      tilematrixSet: "c",
      format: "tiles",
      subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
    }),
  ]),
  imgm2: new L.layerGroup([
    new L.TileLayer.WMTS("http://t{s}.tianditu.gov.cn/img_c/wmts", {
      minZoom: 0,
      maxZoom: 18,
      LAYER: "img",
      tk: tk,
      style: "default",
      tilematrixSet: "c",
      format: "tiles",
      subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
    }),
  ]),
  imga: new L.layerGroup([
    new L.TileLayer.WMTS("http://t{s}.tianditu.gov.cn/cia_c/wmts", {
      minZoom: 0,
      maxZoom: 18,
      tileSize: 256,
      layer: "cia",
      tk: tk,
      styles: "default",
      tilematrixSet: "c",
      format: "tiles",
      subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
    }),
  ]),
  imga2: new L.layerGroup([
    new L.TileLayer.WMTS("http://t{s}.tianditu.gov.cn/cia_c/wmts", {
      minZoom: 0,
      maxZoom: 18,
      tileSize: 256,
      layer: "cia",
      tk: tk,
      styles: "default",
      tilematrixSet: "c",
      format: "tiles",
      subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
    }),
  ]),
  term: new L.layerGroup([
    new L.TileLayer.WMTS("http://t{s}.tianditu.gov.cn/ter_c/wmts", {
      minZoom: 0,
      maxZoom: 18,
      LAYER: "ter",
      tk: "2973256a129b9e727e80cc297545ba0a",
      style: "default",
      tilematrixSet: "c",
      format: "tiles",
      subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
    }),
  ]),
  tera: new L.layerGroup([
    new L.TileLayer.WMTS("http://t{s}.tianditu.gov.cn/cta_c/wmts", {
      minZoom: 0,
      maxZoom: 18,
      tileSize: 256,
      layer: "cta",
      tk: "2973256a129b9e727e80cc297545ba0a",
      styles: "default",
      tilematrixSet: "c",
      format: "tiles",
      subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
    }),
  ]),
};
